home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
tool
/
fapxtool
/
src
/
txm
/
txmfile.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-06
|
949b
|
58 lines
/***************
*
* txm\txmfile.c
*/
#include "txm.h"
char *makenewextname(char *org, char *new, char *ext)
{
char *tmp;
/* printf("makenewextname()\n"); */
strcpy(new, org);
if ((tmp = jstrrchr(new, '\\')) == NULL) {
tmp = new;
}
if ((tmp = strchr(tmp, '.')) == NULL) {
tmp = strchr(new, NUL);
}
strcpy(tmp, ext);
return (new);
}
int accessdir(char *path)
{
char *tmp = work;
/* printf("accessdir()\n"); */
if (access(path, 0) == 0) {
return TRUE;
}
strcpy(work, path);
for (;;) {
if (*tmp == NUL) {
*tmp = '\\';
}
tmp = jstrchr(tmp+1, '\\');
if (work < tmp) {
if (*(tmp - 1) == ':') {
continue;
}
}
if (tmp != NULL) {
*tmp = NUL;
}
/* printf("try(%s)\n", work); */
if (access(work, 0)) { /* != 0 : 存在しない */
if (mkdir(work)) { /* != 0 : 作れない */
return FALSE;
}
}
if (tmp == NULL) break;
}
return TRUE;
}